import { Component } from '@angular/core';
import { ThemeableBrowser, ThemeableBrowserOptions, ThemeableBrowserObject } from '@ionic-native/themeable-browser';

/**
 * Generated class for the XgdsPage page.
 *
 * See https://ionicframework.com/docs/components/#navigation for more info on
 * Ionic pages and navigation.
 */

// @IonicPage()
@Component({
  selector: 'page-xgds',
  templateUrl: 'xgds.html',
})
export class XgdsPage {
  browser:ThemeableBrowserObject;
  private options: ThemeableBrowserOptions = {
    statusbar: {
      color: '#FFA500ff'
    },
    toolbar: {
        height: 44,
        color: '#FFA500ff'
    },
    title: {
        color: '#FFFFFFff',
        showPageTitle: true
    },
    // closeButton: {
    //   wwwImage: 'assets/imgs/back.png',
    //   align: 'left',
    //   event: 'closePressed',
    //   wwwImageDensity: 1.7
    // },
    backButtonCanClose: false
  };
  constructor(
    private themeableBrowser: ThemeableBrowser
    ) {
  }

  ionViewDidLoad() {
    console.log('ionViewDidLoad XgdsPage');
  }
  toXGBD(){
    this.browser = this.themeableBrowser.create('https://w.5gyungou.com/app/index.php?i=3&c=entry&uid=571&do=index&m=fy_lessonv2&wxref=mp.weixin.qq.com#wechat_redirect', '_blank', this.options);
    this.browser.on('loadstart').subscribe(event => {
      console.log('进入星冠')
    });
    this.browser.on('exit').subscribe(event => {
      console.log('离开星冠')
    });
  }
  // 钩子函数 -- 进入页面之后
  ionViewDidEnter(){
    this.toXGBD()
  }

}
